/*
 * @Author: Aaron
 * @Date: 2021-08-25 17:36:04
 * @LastEditors: Aaron
 * @LastEditTime: 2022-03-19 17:34:49
 * @Description: file content
 * @FilePath: \ias_ui\src\api\login.js
 * @Company: 沃尔玛
 */
import request from '../utils/serve'

// user-center api
const newlogin = (param = {}) => {
  return request({
    url: '/user-center/security/user/login',
    method: 'post',
    data: param
  })
}

// const kickToken = (param = {}) => {
// return request({
// url: '/user-center/kickToken',
// method: 'post',
// data: param
// })
// }

const authorities = (param = {}) => {
  return request({
    url: '/user-center/security/user/authorities',
    method: 'post',
    data: param
  })
}

const clearAllToken = (param = {}) => {
  return request({
    url: '/user-center/clearToken',
    method: 'get'
  })
}

const changeUser = (param = {}) => {
  return request({
    url: '/user-center/loginOutApp',
    method: 'post',
    data: param
  })
}

const checkToken = (param = {}) => {
  return request({
    url: '/user-center/checkToken',
    method: 'post',
    data: param
  })
}

const getUserByToken = (param = {}) => {
  return request({
    url: '/user-center/getUserByToken',
    method: 'post',
    data: param
  })
}

export {
  newlogin, // 用户登录
  authorities, // 用户权限查询(按应用角色汇总)
  clearAllToken, // 注销 所有token
  changeUser, // 根据userId,appId注销下线
  checkToken, // 检验token是否有效
  getUserByToken // 通过token获取用户信息
}
